package com.sinaapp.gavinzhang.GSpider.examples;

import com.sinaapp.gavinzhang.GSpider.DefaultPageProcessor;
import com.sinaapp.gavinzhang.GSpider.GSpider;
import com.sinaapp.gavinzhang.GSpider.webaddress.WebAddress;
import org.jsoup.nodes.Document;

/**
 * Created by gavin on 15-7-23.
 */
public class Zhihu extends DefaultPageProcessor {

    /** 打印处网址标题和网址信息 */
    @Override
    public void dispose(Document html, WebAddress webUrl) {
        //System.out.println(html.title());
    }


    public static void main(String[] args) throws Exception{
//        String[] s = new String[1];
//        s[0] = "center";
//        GSpider.main(s);
//        s[0] = "url";
//        GSpider.main(s);
//        s[0] = "processor";
//        GSpider.main(s);
//        ConfigConsoleManagement.initWebAddress = new WebAddress("http://www.zhihu.com/explore",0,0);
//        PageProcessorConfig config = PageProcessorConfig.newPageProcessorConfig();
//        config.getPatterns().add(Pattern.compile("http://www.zhihu.com/question/[0-9]+"));
//        config.setPageProcessor(new Zhihu());
//        ConfigConsoleManagement.pageProcessorConfig =config;
//        ConfigConsoleManagement.setUp();


        //网页版
        String[] s = new String[1];
        s[0] = "center";
        GSpider.main(s);
        s[0] = "url";
        GSpider.main(s);
        s[0] = "processor";
        GSpider.main(s);
        s[0] = "httpserver";
        GSpider.main(s);
    }
}
